home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / bk1.mac < prev    next >
Text File  |  1992-09-06  |  4KB  |  180 lines

  1.  
  2. /*  BK1.MAC - Macros for the editor in the IDE of Borland's */
  3. /*  Turbo C++.        Version 1.0        August 1992 */
  4. /*  Written by Bill Kline   71270,3464 */
  5. /*  */
  6. /*  DOS command to incorporate these macros in the Turbo C++ config file: */
  7. /*  cd \tc\bin    <- Where tcconfig.tc and temc are. */
  8. /*  copy tcconfig.tc tcconfig.tco   <- Save a copy of tcconfig. */
  9. /*  temc bkmacros.mac tcconfig.tc   <- To add macros to config file. */
  10.  
  11.  
  12. Script    BK1EditMacros;
  13.  
  14.  
  15. /* BKCOPYBLOCK: Copy block then hide block. */
  16.  
  17. Macro    BKCopyBlock
  18.     CopyBlock;
  19.     ToggleHideBlock;
  20. End;
  21.  
  22.  
  23. /* BKMOVEBLOCK: Move block then hide block. */
  24.  
  25. Macro    BKMoveBlock
  26.     MoveBlock;
  27.     ToggleHideBlock;
  28. End;
  29.  
  30.  
  31. /* COPYLINE: Copy the line the cursor is on. */
  32.  
  33. Macro    CopyLine
  34.     LeftOfLine;        /* Move cursor to Home. */
  35.     SetBlockBeg;        /* ^K B. */
  36.     CursorDown;
  37.     SetBlockEnd;        /* ^K K, line is selected. */
  38.     CopyBlock;            /* Copy Line. */
  39.     ToggleHideBlock;    /* Hide Block. */
  40. End;
  41.  
  42.  
  43. /* FUNCTIONSTUB: Use to make a function stub at the end of the file. */
  44. /* To use, put cursor on 1st letter of function name.  */
  45. /* NOTE: May have to clean up stub created by this macro */
  46. /* when used on a function having no arguments. */
  47.  
  48. Macro    FunctionStub
  49.     SetMark (0);
  50.     SetBlockBeg;
  51.     WordRight;
  52.     CursorLeft;
  53.     CursorLeft;
  54.     SetBlockEnd;
  55.     EndCursor;
  56.     InsertText ("\n\n\n");
  57.     LeftOfLine;
  58.     InsertText ("void    x");
  59.     RightOfLine;
  60.     BackspaceDelete;
  61.     CopyBlock;
  62.     RightOfLine;
  63.     InsertText (" ()\n{\n\n\n}  /* END OF ");
  64.     CopyBlock;
  65.     ToggleHideBlock;
  66.     MoveToBlockEnd;
  67.     InsertText (" */\n\n");
  68.     MoveToMark (0);
  69. End;
  70.  
  71.  
  72. /* COMMENTINLINE: Uncomments a line of text.  Move cursor to left of */
  73. /* next line. */
  74.  
  75. Macro    CommentInLine
  76.     LeftOfLine;
  77.     DeleteChar;
  78.     DeleteChar;
  79.     RightOfLine;
  80.     BackspaceDelete;
  81.     BackspaceDelete;
  82.     BackspaceDelete;
  83.     LeftOfLine;
  84.     CursorDown;
  85. End;
  86.  
  87.  
  88. /* COMMENTOUTLINE: Comments out a line of text.  Move cursor to left of */
  89. /* next line. */
  90.  
  91. Macro    CommentOutLine
  92.     LeftOfLine;
  93.     InsertText ("/*");
  94.     RightOfLine;
  95.     InsertText (" */");
  96.     LeftOfLine;
  97.     CursorDown;
  98. End;
  99.  
  100.  
  101. /* MAKECOMMENT: Puts a blank commented out area at cursor. */
  102.  
  103. Macro    MakeComment
  104.     LeftOfLine;
  105.     InsertText ("\n");
  106.     LeftOfLine;
  107.     InsertText ("/****************************************************************************");
  108.     InsertText ("\n\n\n\n");
  109.     LeftOfLine;
  110.     InsertText ("****************************************************************************/");
  111.     InsertText ("\n\n");
  112.     CursorUp;
  113.     CursorUp;
  114.     CursorUp;
  115.     CursorUp;
  116. End;
  117.  
  118.  
  119. /* COMMENTOUTBLOCK:  Comments out a highlighted block of text. */
  120.  
  121. Macro    CommentOutBlock
  122.     MoveToBlockBeg;
  123.     InsertText ("\n\n\n\n\n");
  124.     LeftOfLine;
  125.     CursorUp;
  126.     CursorUp;
  127.     CursorUp;
  128.     InsertText ("/****************************************************************************");
  129.     MoveToBlockEnd;
  130.     InsertText ("\n\n\n\n\n");
  131.     LeftOfLine;
  132.     CursorUp;
  133.     CursorUp;
  134.     CursorUp;
  135.     InsertText ("****************************************************************************/");
  136.     ToggleHideBlock;
  137.     LeftOfLine;
  138.     CursorDown;
  139. End;
  140.  
  141.  
  142. /* PARENSCURLYS: Put ()  {\n} at the cursor, move cursor to after (. */
  143.  
  144. Macro    ParensCurlys
  145.     InsertText ("(");
  146.     SetMark (0);
  147.     InsertText (")  {\n");
  148.     InsertText ("}");
  149.     MoveToMark (0);
  150. End;
  151.  
  152.  
  153. /* DELETE5LINES: Deletes 5 lines of text.  Use to remove asterisk comment */
  154. /* lines put in a file by COMMENTOUTBLOCK to uncomment block. */
  155.  
  156. Macro    Delete5Lines
  157.     LeftOfLine;
  158.     DeleteLine;
  159.     DeleteLine;
  160.     DeleteLine;
  161.     DeleteLine;
  162.     DeleteLine;
  163.     LeftOfLine;
  164. End;
  165.  
  166.  
  167.  
  168. /***** KEY BINDINGS: *****/
  169.  
  170. Alt-C:    BKCopyBlock;        /* I conflict, change my key if you want! */
  171. Alt-V:    BKMoveBlock;
  172. Alt-L:    CopyLine;
  173. Alt-U:    FunctionStub;
  174. Alt-I:  CommentInLine;
  175. Alt-O:  CommentOutLine;     /* I conflict, change my key if you want! */
  176. Alt-M:    MakeComment;
  177. Alt-B:    CommentOutBlock;
  178. Alt-A:    ParensCurlys;
  179. Alt-Y:  Delete5Lines;